<?php
	require('qrcode.doc.php');
	//打卡二维码信息
	$app->get(
		'/qrcode/sign',
		function() use($app, $db2){
			$data = $app->request()->get();
			$echo['error'] = "";
			if($data && isset($data['type']) && isset($data['userid']) && isset($data['usertype'])){
				$info = array($data['type'], $data['userid'], $data['usertype']);
				$info = implode(',', $info);
				$echo['info'] = authcode($info, 'ENCODE', 'adaa', 60);
				$echo['destroytime'] = date('Y-m-d H:i:s', strtotime('+60 seconds'));
				//$echo['info2'] = authcode($echo['info'], 'DECODE', 'adaa', 1);
			}else{
				$echo['error'] = "数据缺失，请检查";
			}
			echo json_encode($echo);
		}
	);
	//付款二维码信息
	$app->get(
		'/qrcode/pay',
		function() use($app, $db2){
			$data = $app->request()->get();
			$echo['error'] = "";
			if($data && isset($data['userid']) && isset($data['usertype'])){
				$info = array($data['userid'], $data['usertype']);
				$info = implode(',', $info);
				$echo['info'] = authcode($info, 'ENCODE', 'adaa', 60);
				$echo['destroytime'] = date('Y-m-d H:i:s', strtotime('+60 seconds'));
			}else{
				$echo['error'] = "数据缺失，请检查";
			}
			echo json_encode($echo);
		}
	);
?>